$(function(){
	var userNameNull=$("#userNameNull");
	var passWordNull=$("#passWordNull");
	var loginNo= $("#loginNo");
	$("#userName").blur(function(){
		if(null==$("#userName").val()||""==$("#userName").val()){
			userNameNull.css("display","block");
			
		};
	});
	$("#passWord").blur(function(){
		if(null==$("#passWord").val()||""==$("#passWord").val()){
			passWordNull.css("display","block");
		};
	});
	$("#userName").focus(function(){
		userNameNull.css("display","none");
		loginNo.css("display","none");
	})
	$("#passWord").focus(function(){
		passWordNull.css("display","none");
		loginNo.css("display","none");
	})
	
	
	
	
	
	$("#submit").click(function(){
		var userName=$("#userName").val();
		var passWord=$("#passWord").val();
		if((null!=userName&&""!=userName)&&(null!=passWord&&""!=passWord)){
			
			$.post("login",{"userName":userName,"passWord":passWord},function(r){
				var obj=eval("("+r+")"); 
				var num=obj.num;
				if(0==num){
					loginNo.css("display","block");
				}else{
			//跳转页面						
					location.href="/";
				}
			})
		}else{
			loginNo.css("display","block");
		}
		
	})
})